package ru.spbau.design.snmp.android.viewer.model;

public abstract class NetNode {
	public NetNode(IPAddress address, 
			String name, SubNet subNet) {
		this.address = address;
		this.name = name; 
		this.subNet = subNet;
	}
	
	public IPAddress getAddress() {
		return address;
	}
	
	public String getName() {
		return name;
	}
	
	public SubNet getSubNet() {
		return subNet;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((address == null) ? 0 : address.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		NetNode other = (NetNode) obj;
		if (address == null) {
			if (other.address != null)
				return false;
		} else if (!address.equals(other.address))
			return false;
		return true;
	}

	abstract NetNodeType getType();
	
	private final IPAddress address;
	private final String name;
	private final SubNet subNet;
} 